@extends('layout.master')

@section('content')

<div id="signup-page-jumbotron" class="page-single-jumbotron jumbotron">

  <div class="panel panel-primary">
    <div class="panel-heading">
      <h3 class="panel-title lead">
        欢迎加入课后网
        {{$errors->first('addError', '<small class="text-warning">:message</small>')}}
      </h3>
    </div>
    <div class="panel-body">
      {{Form::open(['action'=>'AuthorityController@postSignup', 'role'=>'form', 'class'=>'form-horizontal'])}}

        <div class="input-group">
          <div class="input-group-addon"><span class="glyphicon glyphicon-user"></span></div>
          <input type="text" class="form-control" value="{{Input::old('username')}}" name="username" required placeholder="用户名（用于登陆）"/>
        </div>
        {{$errors->first('username', '<div class="alert alert-danger" role="alert">:message</div>')}}

        <div class="input-group">
          <div class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span></div>
          <input type="email" class="form-control" value="{{Input::old('email')}}" name="email" required placeholder="电子邮件地址（用于登陆)" />
        </div>
        {{$errors->first('email', '<div class="alert alert-danger" role="alert">:message</div>')}}

        <div class="input-group">
          <div class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></div>
          <input type="password" class="form-control" value="{{Input::old('password')}}" name="password" required placeholder="登陆密码" />
        </div>
        {{$errors->first('password', '<div class="alert alert-danger" role="alert">:message</div>')}}

        <div class="input-group">
          <div class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></div>
          <input type="password" class="form-control" value="{{Input::old('password_confirmation')}}" name="password_confirmation" required placeholder="再次输入密码" />
        </div>

        <div  class="form-group" style="margin-top: 2em">
          <label class="col-sm-2 control-label" for="role">用户类型</label>
          <div class="col-sm-10">
            <select class="form-control" value="{{Input::old('role_id')}}" name="role_id" id="role">
              @foreach( $roles as $curr_role)
                <option value="{{$curr_role->id}}">{{$curr_role->label}}</option>
              @endforeach
            </select>
          </div>
        </div>

        <div class="form-control-btn"><center>
          <a href="{{URL::to('/')}}" class="btn btn-warning">取消返回</a>
          <button class="btn btn-success" type="submit">确认注册</button>
        </center></div>

      {{Form::close()}}
    </div>
  </div>

</div>

@stop